﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;

namespace KLLSVC_Console
{
    class Program
    {
        static void Main(string[] args)
        {
            using (System.Net.WebClient wc = new System.Net.WebClient())
            {
                try
                {
                    //System.Net.NetworkCredential c = new System.Net.NetworkCredential("KEPPELLAND\\zhixian.ong", "p@ssw0rd5");
                    //wc.Credentials = new System.Net.NetworkCredential("KEPPELLAND\\zhixian.ong", "p@ssw0rd5");
                    
                    // create credentials, base64 encode of username:password
                    //string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("KEPPELLAND\\zhixian.ong" + ":" + "p@ssw0rd5"));

                    // Inject this string as the Authorization header
                    //wc.Headers[HttpRequestHeader.Authorization] = string.Format("Basic {0}", credentials); 

                    CredentialCache cc = new CredentialCache();
                    cc.Add(new Uri("http://dev.e-overtime.web/"), "NTLM",
                        new NetworkCredential("***username***", "***pass***", "***domain***"));
                    wc.Credentials = cc;

                    string result = wc.DownloadString("http://dev.e-overtime.web/");
                    Console.WriteLine(result);
                } 
                catch (Exception)
                {
                }
            }

        } // static void Main(string[] args)
    } // class Program
} // namespace KLLSVC_Console